// C++ author 清晨与猫鱼
#include <iostream>
#include <string>
#include "Realize.h"

using namespace std;

int main(const int argc, const char** argv)
{	
    // 发起人和临时代理人
    Originator originator;
    CareTaker careTaker;

    // 设置状态
    originator.setState("State #1");
    originator.setState("State #2");

    // 保存状态
    careTaker.add(originator.saveStateToMemento());

    // 改变状态
    originator.setState("State #3");

    // 保存状态
    careTaker.add(originator.saveStateToMemento());

     // 改变状态
    originator.setState("State #4");

    // 获取当前状态
    cout << "Current State: " << originator.getState() << endl;

    // 获取之前的第一个状态
    originator.getStateFromMemento(careTaker.get(0));

    cout << "First saved State: " << originator.getState() << endl;

    // 获取之前的第二个状态
    originator.getStateFromMemento(careTaker.get(1));

    cout << "Second saved State: " << originator.getState() << endl;

}